package secondriver.springsubway.example.aop.demo;

import org.aopalliance.intercept.MethodInvocation;
import org.springframework.aop.support.DelegatingIntroductionInterceptor;

public class TesterIntroductionInterceptor extends
		DelegatingIntroductionInterceptor implements Tester {

	private static final long serialVersionUID = 1L;

	private boolean isBusy = false;

	@Override
	public Object invoke(MethodInvocation mi) throws Throwable {
		if (isBusy() && mi.getMethod().getName().equals("doDevelop")) {
			System.out.println("Tester is busying !!!");
		}
		return super.invoke(mi);
	}

	@Override
	public String doTest() {
		return "I am a tester , working test.";
	}

	@Override
	public boolean isBusy() {
		return isBusy;
	}

	public void setBusy(boolean isBusy) {
		this.isBusy = isBusy;
	}
}
